﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExampleAppPart1.aspx.cs" Inherits="SPAPCF.CoreWeb.Pages.ExampleAppPart1" %>

<!DOCTYPE html>

<html>
<head>
    <title></title>
    <script src="/scripts/jquery-1.9.1.js"></script>
    <script src="/scripts/apcf.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function () { window.attachEvent('onmessage', APCF.processMessage); });

        var params = document.URL.split("?")[1].split("&");
        for (var i = 0; i < params.length; i = i + 1) {
            var param = params[i].split("=");
            if (param[0].toLowerCase() == "senderid") {
                this.senderId = decodeURIComponent(param[1]);
            }
        }

        $(document).ready(function () { window.setTimeout(registerType, 0); });

        function registerType() {

            var appPartTypeData = new APCFAppPartType("APCFRegisterAppPartType", "ExampleAppPart1", "https://dev18spapcfprov.gbls.co.uk/scripts/apcfexampleapppart1.js", this.senderId);
            window.parent.postMessage(JSON.stringify(appPartTypeData), "*");

        }

        function registerInstance() {
            var o = new Object();
            o.messageType = "APCFRegisterAppPartInstance";
            o.senderId = this.senderId;
            o.typeAsText = "ExampleAppPart1";
            o.width = 100;
            o.height = 100;
            o.text = "this is my example app part";
            text = JSON.stringify(o);
            window.parent.postMessage(text, "*");
        }
    </script>
</head>
<body>
    some content here
</body>
</html>
